Skip to main content

All Questions

3votes
2answers
6kviews

Detecting Intersections of a Collection of Singly-Linked Lists

I was recently presented with the following problem... You are given a collection of singly-linked lists (SLLs). Return true if any of them share a common node (or “intersect”), or false otherwise. ...
James Law's user avatar
1vote
1answer
90views

Reverse a sublist of a singly-linked master list in constant space and maximum of one pass (Java)

So I found this funky programming challenge somewhere on Quora. The idea is to take the head of a singly-linked list, and reverse a specific sublist. The requirements are: runs in constant space, ...
coderodde's user avatar
1vote
3answers
806views

Remove nth node from last position in linked list

Description: Given a linked list, remove the nth node from the end of list and return its head. Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the ...
CodeYogi's user avatar
3votes
3answers
2kviews

Reverse part of a linked list

I'm learning data structures. I'm working on linked lists at the moment, and I'd like to have a strong grasp on them. Below is the last problem I solved. I'd like to know what you think of the ...
Chris Yates's user avatar
20votes
3answers
4kviews

Reversing k-sized sequences in a linked-list

Here is my solution to this problem; please be brutally honest/strict, if I would have written this code, in a 45 minute interview, what would you think? (I am aiming for Google,Facebook). Here is ...
bazang's user avatar
  • 2,236
13votes
3answers
992views

Reversing a linked list

I implemented reversing a linked list in iterative way, just by knowing we need 3 pointers and I have never seen a code before, when I coded. I ran this code and tested it, it works fine. Even for ...
howtechstuffworks's user avatar
6votes
2answers
1kviews

Flattening a doubly linked list

I am a Java dev and trying to prepare for interviews in C++. Can someone please review the below solution for me? Assume that you are given the head and tail pointers of a doubly linked list where ...
p101's user avatar
  • 333

close